package fileupdownYouhua.web;

import fileupdownYouhua.dao.DatabaseDaoIml;
import fileupdownYouhua.service.DeleteService;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/delete")
public class DeleteServlet extends HttpServlet {
    public static final String path = "D:\\CodeAll\\code\\FirstWeb\\src\\main\\webapp\\resourse\\";
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws  IOException {
        String shan = req.getParameter("shan");
        String name = req.getParameter("name");

        //数据库的操作 删除某条数据
        new DatabaseDaoIml().deleteBase(shan,name);

        //删除文件
        DeleteService.deleuteService(path,name);

        resp.sendRedirect("/index");
    }
}
